/*
********************************************************************************
* Copyright (C) 2021, xiang.D <dx_65535@163.com>.
* All right reserved.
*
* File Name   : control_tower.h
* Author      :
* Version     : V1.0
* Description :
* Journal     : 2021-1-20 version v1.0
* Brief       : Blog: https://blog.csdn.net/qq_38750572?spm=1001.2014.3001.5343
* Others      :
                Compile command: make
********************************************************************************
*/
#ifndef __CONTROL_TOWRE_H__
#define __CONTROL_TOWRE_H__

#include <map>
#include "control_tower_base.h"

class CChengduTowerMediator : public CTowerMediatorBase
{
public:
    CChengduTowerMediator();

    ~CChengduTowerMediator();

    static CChengduTowerMediator* GetInstance();

    // 注册飞机实例
    int Register(CAirplaneBase* airplane);

    // 注销指定飞机ID
    int UnRegister(int RegisterId);

    // 向指定飞机发送消息
    int SendMsg(int RegisterId, void *msg);

    // 向所有注册飞机发送广播
    int NotifyObserverAll(void *msg);

    // 接收飞机消息
    int Receive(int id, void *msg);

private:
    // 飞机注册表
    std::map<int, CAirplaneBase*> mAirplaneHashTable;
};

#endif